namespace Domotica.Media
{
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    public class DictionaryCollection<TKey, TValue>
    {
        private Dictionary<TKey, TValue> _dictionary;
        private List<TValue> _list;

        public DictionaryCollection()
        {
            this._dictionary = new Dictionary<TKey, TValue>();
            this._list = new List<TValue>();
        }

        public void Add(TKey key, TValue value)
        {
            this._dictionary.Add(key, value);
            this._list.Add(value);
        }

        public int IndexOf(TValue value)
        {
            return this._list.IndexOf(value);
        }

        public bool TryGetValue(TKey key, ref TValue value)
        {
            return this._dictionary.TryGetValue(key, out value);
        }

        public int Count
        {
            get
            {
                return this._list.Count;
            }
        }

        public TValue this[TKey key]
        {
            get
            {
                return this._dictionary[key];
            }
        }

        public TValue this[int index]
        {
            get
            {
                return this._list[index];
            }
        }

        public List<TValue> Values
        {
            get
            {
                return this._list;
            }
        }
    }
}

